package com.liu.efk.zdcq.util;

/**
 * Created by shi860715@126.com
 * Date 2021/5/10 8:47
 * Description
 */
public class TaskIDGen {

    private static TaskIDGen instance = new TaskIDGen();

    private static int taskId = 1;

    private TaskIDGen(){}

    public  static  TaskIDGen getInstance(){
        return  instance;
    }

    public static   String getTaskId(){

        String result ="";
        if(taskId==99999){
            taskId=1;
             return  "00001";
        }
        taskId++;
        result=taskId+"";
        while (result.length()<5){
            result="0"+result;
        }
        return result;

    }

    public static void main(String[] args) {
        TaskIDGen idwork = TaskIDGen.getInstance();

        int i=0;
        while (i<10){

            i++;
            System.out.println(idwork.getTaskId());
        }
    }

}
